package main

import (
	"fmt"
	"io/ioutil"
	"strings"
	"time"
)

func copyFile(fileName string) {
	rfile, err := ioutil.ReadFile(fileName)
	if err != nil {
		fmt.Println(err)
	}
	data := string(rfile)

	var build strings.Builder

	newName := time.Now().Format("2006-01-02_15_04_05")
	build.WriteString(newName)
	build.WriteString(fileName)
	resFile := build.String()

	errors := ioutil.WriteFile(resFile, []byte(data), 0666)
	if errors != nil {
		fmt.Println(errors)
	}

}

func main() {
	copyFile("1.txt")
}
